package inseniarlingua.lang

class Phrase {
	def groups
	
	Phrase(groups) {
		this.groups = groups
	}

	@Override
	public boolean equals(Object phrase) {
		if ( ! (phrase instanceof Phrase)) return false
		if (groups == phrase.groups) return true
		if (groups.size() != phrase.groups.size()) return false
		
		def flag = true
		for (i in 0..<groups.size()) {
			def si = groups[i]
			if (si == phrase.groups[i] || si == '*') {
			}
			else {
				flag = false
				break
			}
		}
		return flag
	}

	@Override
	public String toString() {
		return groups.join(' ')
	}
}
